package com.tencent.sr.iris.basic.mp.dependency;

import com.tencent.sr.rmall.common.primitive.HttpResult;
import com.tencent.sr.rmall.shorturl.interfaces.client.ShortUrlClient;
import com.tencent.sr.rmall.shorturl.interfaces.vo.ShortRequest;
import com.tencent.sr.rmall.shorturl.interfaces.vo.ShortResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 短链服务依赖
 * @author wangshun
 * @create 2020-12-28 2:30 下午
 **/
@Component
public class ShortUrlDependency {

    @Autowired
    private ShortUrlClient shortUrlClient;

    public ShortResponse getShortUrl(ShortRequest request) {
        HttpResult<ShortResponse> result = shortUrlClient.getShortUrl(request);
        if (result != null && result.isSuccess()) {
            return result.getData();
        }
        return null;
    }


}